from django.db import models

# Create your models here.
class Student(models.Model):
    SET_DN =(
        (0, '女'),
        (1, '男')
             )

    name = models.CharField(max_length=20, verbose_name='姓名')
    age = models.IntegerField(null=True, blank=True, verbose_name='年龄')
    sex = models.IntegerField(null=True, blank=True, verbose_name='性别',choices=SET_DN)
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间')
    # 逻辑删除 如果是False 给用户显示 如果不是就不显示
    is_delete = models.BooleanField(default=False, verbose_name='逻辑删除')
    classes= models.ForeignKey('Classes', on_delete=models.SET_NULL, null=True)
    class Mate:
        db_table = 'student'
class Classes(models.Model):
    name = models.CharField(max_length=20, verbose_name='班级名')
    slogan = models.TextField(null=True, blank=True, verbose_name='口号')
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间')
    class Mate:
        db_table = 'classes'